package com.stylefeng.guns.modular.system.controller;

import com.stylefeng.guns.core.base.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import com.stylefeng.guns.core.log.LogObjectHolder;
import org.springframework.web.bind.annotation.RequestParam;
import com.stylefeng.guns.modular.system.model.PhoneUserinfoRepeat;
import com.stylefeng.guns.modular.system.service.IPhoneUserinfoRepeatService;

/**
 * 用户信息重复表控制器
 *
 * @author fengshuonan
 * @Date 2018-11-07 17:21:47
 */
@Controller
@RequestMapping("/phoneUserinfoRepeat")
public class PhoneUserinfoRepeatController extends BaseController {

    private String PREFIX = "/system/phoneUserinfoRepeat/";

    @Autowired
    private IPhoneUserinfoRepeatService phoneUserinfoRepeatService;

    /**
     * 跳转到用户信息重复表首页
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "phoneUserinfoRepeat.html";
    }

    /**
     * 跳转到添加用户信息重复表
     */
    @RequestMapping("/phoneUserinfoRepeat_add")
    public String phoneUserinfoRepeatAdd() {
        return PREFIX + "phoneUserinfoRepeat_add.html";
    }

    /**
     * 跳转到修改用户信息重复表
     */
    @RequestMapping("/phoneUserinfoRepeat_update/{phoneUserinfoRepeatId}")
    public String phoneUserinfoRepeatUpdate(@PathVariable Integer phoneUserinfoRepeatId, Model model) {
        PhoneUserinfoRepeat phoneUserinfoRepeat = phoneUserinfoRepeatService.selectById(phoneUserinfoRepeatId);
        model.addAttribute("item",phoneUserinfoRepeat);
        LogObjectHolder.me().set(phoneUserinfoRepeat);
        return PREFIX + "phoneUserinfoRepeat_edit.html";
    }

    /**
     * 获取用户信息重复表列表
     */
    @RequestMapping(value = "/list")
    @ResponseBody
    public Object list(String condition) {
        return phoneUserinfoRepeatService.selectList(null);
    }

    /**
     * 新增用户信息重复表
     */
    @RequestMapping(value = "/add")
    @ResponseBody
    public Object add(PhoneUserinfoRepeat phoneUserinfoRepeat) {
        phoneUserinfoRepeatService.insert(phoneUserinfoRepeat);
        return SUCCESS_TIP;
    }

    /**
     * 删除用户信息重复表
     */
    @RequestMapping(value = "/delete")
    @ResponseBody
    public Object delete(@RequestParam Integer phoneUserinfoRepeatId) {
        phoneUserinfoRepeatService.deleteById(phoneUserinfoRepeatId);
        return SUCCESS_TIP;
    }

    /**
     * 修改用户信息重复表
     */
    @RequestMapping(value = "/update")
    @ResponseBody
    public Object update(PhoneUserinfoRepeat phoneUserinfoRepeat) {
        phoneUserinfoRepeatService.updateById(phoneUserinfoRepeat);
        return SUCCESS_TIP;
    }

    /**
     * 用户信息重复表详情
     */
    @RequestMapping(value = "/detail/{phoneUserinfoRepeatId}")
    @ResponseBody
    public Object detail(@PathVariable("phoneUserinfoRepeatId") Integer phoneUserinfoRepeatId) {
        return phoneUserinfoRepeatService.selectById(phoneUserinfoRepeatId);
    }
}
